/**
 * @author luguoxiang
 * @date 2022/7/5
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
import { createApi, request, toMd5 } from '@/soar';

export const basePath = '/system/user';
export const subject = '用户';
const api = createApi(basePath, subject);

export default {
  ...api,
  updatePassword: (ids, password) => {
    return request.post(`${basePath}/update-password`, { data: { password: toMd5(password.trim()), ids } });
  },
  updateStatus: (data) => request.post(`${basePath}/update-status`, { data }),
  clearCache: (userId) => request.post(`${basePath}/clear-cache`, { params: { userId } }),
  setRoleIds: (data) => request.post(`${basePath}/set-role-ids`, { data }),
  getRoleIds: (userId) => request.get(`${basePath}/get-role-ids`, { params: { userId } }),
  setPosts: (data) => request.post(`${basePath}/set-posts`, { data }),
  getPosts: (userId) => request.get(`${basePath}/get-posts`, { params: { userId } }),
};
